/// <license>
/// Copyright (c) 2002-2008, DotNetNuke Corporation
/// All rights reserved
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
/// documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
/// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
/// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
/// of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
/// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
/// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
/// DEALINGS IN THE SOFTWARE.
/// </license>

#region Using Statements

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;

using DotNetNuke.ModuleToolkit.Common;
using DotNetNuke.ModuleToolkit.Modules.Skinning;

#endregion

namespace DotNetNuke.ModuleToolkit.Modules.Skinning.SkinObjects
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The IndividualsDataSource skin object provides a DataSource for a list of
    /// Individuals.
    /// </summary>
    /// <history>
    /// 	[cnurse]	01/08/2007	created
    /// </history>
    /// -----------------------------------------------------------------------------
    public class BaseDataSource : ModuleSkinObjectBase
    {

        #region Private Members

        private int _PageSize;
        private int _TotalRecords;

        #endregion

        #region Public Properties

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets the Current Page
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/13/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Browsable(false)]
        public int CurrentPage
        {
            get
            {
                int _CurrentPage = 1;
                //Get Page if set Id if set
                if (this.Context.Request.QueryString[Constants.PARAM_CurrentPage] != null)
                {
                    _CurrentPage = Int32.Parse(this.Context.Request.QueryString[Constants.PARAM_CurrentPage]);
                }
                return _CurrentPage;
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets a flag that indicates whether this List is Paged
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/13/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Behavior"),
        DefaultValue(true),
        Description("Determines whether to use paging.")]
        public bool IsPaged
        {
            get
            {
                bool? display = (bool?)ViewState["IsPaged"];
                return (display == null) ? true : display.Value;
            }
            set { ViewState["IsPaged"] = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Page Size
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/13/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Bindable(true),
        Category("Behavior"),
        DefaultValue(10),
        Description("The PageSize for the List")]
        public int PageSize
        {
            get { return _PageSize; }
            set { _PageSize = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Total Records
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/13/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public int TotalRecords
        {
            get { return _TotalRecords; }
            set { _TotalRecords = value; }
        }

        #endregion

    }
}
